## Controller Python Script "question_add"
##bind container=container
##bind context=context
##bind namespace=
##bind script=script
##bind subpath=traverse_subpath
##parameters=field_type, page=None
##title=Question Add
_ = context.translate
status='success'

response = context.REQUEST.RESPONSE
response.setHeader('Content-Type', 'text/xml')

try:
	newid = context.addQuestion(field_type,page=page)
	status='success'
except ValueError:
	status= _(msgid='You must select what type of question to add.', domain='archsurvey')

xml = context.question_add_response( portal = context.portal_url ,
				      here = context,
				      field = getattr( context, newid, None ),
				      status = status)
response = """<?xml version="1.0" ?>""" + xml
return response
